/* -+- file  ./kf2/GUI/Pixbufs.cs -+- */
/*
 * kf2 jabber client
 * ~~~~~~~~~~~~~~~~~
 *
 * Copyright (C) 2006-2007 Przemysław Sitek
 * 				<przemyslaw.sitek at wp.pl> 
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

using System;
using Habazie.kf2.Roster;

namespace Habazie.kf2.GUI
{
	///<summary>Pixbuf item</summary>
	public enum Pixbuf {
		///<summary>Hourglass icon</summary>
		Hourglass = 0,
		
		///<summary>Message icon</summary>
		Message = 1,
		
		///<summary>Chat icon</summary>
		Chat = 2,
		
		///<summary>System icon</summary>
		System = 3
	}
	
	public class Pixbufs
	{
		static Gdk.Pixbuf [] status;
		static Gdk.Pixbuf [] images;
		
		static Pixbufs ()
		{
			status = new Gdk.Pixbuf[9];
			status[0] = Gdk.Pixbuf.LoadFromResource ("online.png");
			status[1] = Gdk.Pixbuf.LoadFromResource ("chat-with-me.png");
			status[2] = Gdk.Pixbuf.LoadFromResource ("away.png");
			status[3] = Gdk.Pixbuf.LoadFromResource ("xa.png");
			status[4] = Gdk.Pixbuf.LoadFromResource ("dnd.png");
			status[5] = Gdk.Pixbuf.LoadFromResource ("offline.png");
			status[6] = Gdk.Pixbuf.LoadFromResource ("offline-account.png");
			status[7] = Gdk.Pixbuf.LoadFromResource ("unknown.png");
			status[8] = Gdk.Pixbuf.LoadFromResource ("error.png");
			

			images = new Gdk.Pixbuf[4];
			images[0] = Gdk.Pixbuf.LoadFromResource ("hourglass.png");
			images[1] = Gdk.Pixbuf.LoadFromResource ("pix_message.png");
			images[2] = Gdk.Pixbuf.LoadFromResource ("pix_chat.png");
			images[3] = Gdk.Pixbuf.LoadFromResource ("pix_system.png");
		}
		
		public static Gdk.Pixbuf Get (jabber.protocol.client.PresenceType p, string show)
		{
			if (p == jabber.protocol.client.PresenceType.available) {
				if (show != null && show != "") {
					switch (show) {
						case "chat": return status[1];
						case "away": return status[2];
						case "xa":   return status[3];
						case "dnd":  return status[4];
						default:     return status[0];
					}
				} else {
					return status[0];
				}
			} else
				return status[6];
		}
		
		public static Gdk.Pixbuf Get (Item item, Resource res)
		{
			if (item.Sub == jabber.protocol.iq.Subscription.both ||
				item.Sub == jabber.protocol.iq.Subscription.from) {
			} else {
			}
			
			return status[6];
		}
		
		public static Gdk.Pixbuf Image (Pixbuf p)
		{
			return images[(int)p];
		}
	}
}
